/**
 * Copyright (C), 2015-2020, XXX有限公司
 * <p>
 * FileName: Tag
 * <p>
 * Author:   Brill
 * <p>
 * Date:     2020/2/27/027 20:38
 * <p>
 * Description: 标签实体类
 * <p>
 * History:
 *
 * <author>          <time>          <version>          <desc>
 * <p>
 * 作者姓名           修改时间           版本号              描述
 */


package cn.yuhh.entity;


import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;

/**
 * 〈一句话功能简述〉<br> 
 * 〈标签实体类〉
 *
 * @author Brill

 * @create 2020/2/27/027

 * @since 1.0.0

 */
@Entity
@Table(name = "t_tag")
public class Tag {

    @Id
    @GeneratedValue
    private Long id;
    private String name;
    @ManyToMany(mappedBy = "tags")
    private List<Blog> blogs = new ArrayList<>();

    public Tag() {
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<Blog> getBlogs() {
        return blogs;
    }

    public void setBlogs(List<Blog> blogs) {
        this.blogs = blogs;
    }

    @Override
    public String toString() {
        return "Tag{" + "id=" + id + ", name='" + name + '\'' + ", blogs=" + blogs + '}';
    }
}
